package com.ebelter.myehc.ui.fragments;


import android.os.Bundle;
import android.widget.TextView;

import com.ebelter.btcomlib.bases.fragment.BaseFragment;
import com.ebelter.btcomlib.models.bluetooth.products.bloodoxgen.BOManager;
import com.ebelter.btcomlib.models.bluetooth.products.bloodoxgen.bean.BOMesureResultBean;

import com.ebelter.btcomlib.utils.ViewUtils;

import com.ebelter.btcomlib.views.LevelColorView;
import com.ebelter.myehc.R;
import com.ebelter.myehc.ui.view.CombinView5;
import com.ebelter.myehc.utils.ViewUtilsEHC;


/**
 * 血氧
 */

public class BO_Fragment extends BaseFragment {
    public static final String TAG = "BO_Fragment";
    LevelColorView bo_lcv;
    CombinView5 cb5_bo1;//血氧
    CombinView5 cb5_bo2;//脉搏
    @Override
    protected int setLayoutResouceId() {
        return R.layout.fragment_bo;
    }
    @Override
    protected void initView() {
        super.initView();
        FV();
    }

    private TextView activityTopTittleTv;

    public void setActivityTopTittleTv(TextView activityTopTittleTv) {
        this.activityTopTittleTv = activityTopTittleTv;
    }

    private void FV() {
        bo_lcv=mRootView.findViewById(R.id.bo_lcv);
        cb5_bo1=mRootView.findViewById(R.id.cb5_bo1);
        cb5_bo2=mRootView.findViewById(R.id.cb5_bo2);
    }

    @Override
    protected void initData(Bundle arguments) {
        super.initData(arguments);
        ViewUtilsEHC.setCb5Title2(cb5_bo1,N);
        ViewUtilsEHC.setCb5Title2(cb5_bo1,N);
    }

    public void setMesureing(int value) {
        if (cb5_bo1!=null) cb5_bo1.setTitle2(value+"");
    }

    public void setMesureResult(BOMesureResultBean resultBean) {
        if (cb5_bo1!=null) cb5_bo1.setTitle2(resultBean.bloodOxygen+"");
        if (cb5_bo2!=null) cb5_bo2.setTitle2(resultBean.pulse+"");
        ViewUtils.displayView(bo_lcv);
        if (bo_lcv!=null) bo_lcv.setLevel(BOManager.getBOLevel(resultBean.bloodOxygen));
        ViewUtils.setTextViewStr(activityTopTittleTv,BOManager.getBOLevelDesc(resultBean.bloodOxygen));
    }
}
